﻿using Common.Core.Extension;
using Common.Extension;
using System.ComponentModel;

namespace NetByDocker.Core.Common;

/// <summary>
/// 文件信息返回类
/// </summary>
public class FileViewModel
{
    /// <summary>
    /// 文件名
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// 内容
    /// </summary>
    public byte[] Content { get; set; }

    /// <summary>
    /// 文件类型
    /// </summary>
    public string ContentType { get; set; }

    public FileViewModel()
    {
    }

    public FileViewModel(string name)
    {
        Name = name;
        ContentType = name.GetMimeType();
    }

    public FileViewModel(byte[] content, string name)
    {
        Content = content;
        Name = name;
        ContentType = name.GetMimeType();
    }
}